package com.test.web.controller;

import com.he.core.ResultT;
import com.test.web.entity.Version;
import com.test.web.service.VersionService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author heyanjing
 * date:2020-06-09 2020/6/9:22:54
 */
@Slf4j
@AllArgsConstructor
@RestController
public class VersionController {

    private VersionService versionService;


    @PostMapping("/version/insert")
    public ResultT insert(@RequestBody Version record) {
        this.versionService.insert(record);
        return ResultT.success();
    }

    @GetMapping("/version/selectByPrimaryKey")
    public ResultT selectByPrimaryKey(String versionId) {
        return ResultT.successWithData(this.versionService.selectByPrimaryKey(versionId));
    }

    @PostMapping("/version/updateByPrimaryKeySelective")
    public ResultT updateByPrimaryKeySelective(@RequestBody Version record) {
        this.versionService.updateByPrimaryKeySelective(record);
        return ResultT.success();
    }

    @GetMapping("/version/deleteByPrimaryKey")
    public ResultT deleteByPrimaryKey(String versionId) {
        return ResultT.successWithData(this.versionService.deleteByPrimaryKey(versionId));
    }

}
